<!DOCTYPE html>
<html lang="en" xmlns: xmlns:th="http://www.thymeleaf.org">
<head th:include="common/admin/common::common_head">
    <title>管理员首页</title>
</head>
<body class="cm-no-transition cm-1-navbar">
<div th:include="common/admin/common::common_footer_script"/>
<!--后台公共侧边栏（菜单）-->
<div th:replace="common/admin/common::common_siderbar"></div>
<!--后台公共顶部-->
<div th:replace="common/admin/common::common_top"></div>
<div id="global">
    <div class="container-fluid">
        <div class="row">
            <div class="col-md-12">
                <div class="panel panel-default">
                    <div class="panel-heading">审核信息</div>
                    <div class="panel-body">
                        <p style="margin-bottom:0">Audit should be careful <code>and do not be distracted</code></code></p>
                    </div>
                    <table class="table">
                        <thead>
                        <tr>
                            <th>#</th>
                            <th>真实姓名</th>
                            <th>地址</th>
                            <th>贷款类型</th>
                            <th>电话</th>
                            <th>身份证</th>
                            <th>最小贷款数</th>
                            <th>审批</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr class="active" th:each="entry:${makelist}">
                            <th scope="row" th:text="${entry.id}"></th>
                            <td th:text="${entry.name}"></td>
                            <td th:text="${entry.address}"></td>
                            <td th:text="${entry.loantype}"></td>
                            <td th:text="${entry.phone}"></td>
                            <td th:text="${entry.idcard}"></td>
                            <td th:text="${entry.minmoney}"></td>
                            <td>
                                <a class="btn btn-success" onclick="makesubmit(id)" th:id="tony+${entry.id}" th:value="${entry.id}">同意</a>
                                <!--<div><a href="#"><span style="visibility:hidden">我的</span></a></div>-->

                            </td>
                        </tr>
                    </table>
                </div>
            </div>
        </div>
        <ul class="pagination" style="margin-left: 500px">
            <li><a th:href="@{/loan/back-make/makelist(currPage=1)}">&laquo;</a></li>
            <li><a th:href="@{/loan/back-make/makelist(currPage=${pager.currPage-1})}">&lt;</a></li>
            <!--<li th:each="pp:${pager.totalPage}"><a href="#" th:text="${pp}">1</a></li>-->
            <li th:each="pagenum:${#numbers.sequence(1,pager.totalPage)}">
                    <span th:if="${pagenum} != 0">
                        <a th:href="@{/loan/back-make/makelist(currPage=${pagenum})}" th:text="${pagenum}"></a>
                    </span>
            </li>
            <li><a th:href="@{/loan/back-make/makelist(currPage=${pager.currPage+1})}">&gt;</a></li>
            <li><a th:href="@{/loan/back-make/makelist(currPage=${pager.totalPage})}">&raquo;</a></li>
        </ul>
    </div>
    <div class="modal fade" id="myModal" tabindex="-1">
        <div class="modal-dialog modal-md"><!--modal-sm 设置模态框尺寸-->
            <div class="modal-content">

                <div class="modal-header">
                    <button class="close" data-dismiss="modal">&times;</button>
                    <h4 class="modal-title">金额审批</h4>
                </div>
                <div class="modal-body">
                    <form id="loginform">
                        <input id="makeid" name="id" type="hidden"/>
                        <!--<div class="form-group">
                            <label>最小贷款数:</label>
                            <input name="minmoney" readonly unselectable="on"   id="minmoney" class="form-control" type="text" />
                        </div>-->
                        <div class="form-group">
                            <label>最大贷款数</label>
                            <input class="form-control" id="maxmoney" name="maxmoney" placeholder="请输入金额" type="text"/>
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <input id="submitUrl" type="hidden"/>
                    <font color="red" id="msg"></font>
                    <button class="btn btn-primary" onclick="makeupd()">提交</button>
                    <button class="btn btn-default" data-dismiss="modal">关闭</button>
                </div>
            </div>
        </div>
    </div>
    <footer class="cm-footer"><span class="pull-left">Connected as John Smith</span><span class="pull-right">&copy; PAOMEDIA SARL</span></footer>
</div>
<script>
    function makesubmit(age) {
        //提交审核结果url
        var submitUrl = age;
        $('#submitUrl').val(submitUrl);//给会话中的隐藏属性URL赋值
        /*var audid = $("#tony").attr("value");
        var minmon = $("#inmoney").attr("value");
        $('#makeid').val(audid);//给会话中的隐藏属性URL赋值
        $('#minmoney').val(minmon);//给会话中的隐藏属性URL赋值*/
        $('#myModal').modal();
    }

    function makeupd() {
        var maxmoney = $('#maxmoney').val();
        var submitUrls = $.trim($("#submitUrl").val());//获取会话中的隐藏属性URL
        var intid = $("#" + submitUrls + "").attr("value");

        if (maxmoney != '' && !isNaN(maxmoney) && maxmoney > 0) {
            $.post("[[@{/loan/back-make/makeupd}]]", {id: intid, maxmoney: maxmoney}, function (data) {
                /*if(data){
                    location.reload();
                }else {
                    $('#msg').html("账号或密码错误");
                    setTimeout("$('#msg').html('');",4000);
                }*/
                window.location.reload();
                layer.msg('提交成功！', {time: 1300});
            }, "text");
        } else {
            layer.msg('请正确输入数值。', {time: 1300});
        }
    }
</script>
<!--<script th:replace="common/admin/common::common_footer"></script>-->
<script th:src="@{/admin/assets/js/demo/home.js}"></script>
</body>
</html>
